﻿using PluginAPI.Core;
using PluginAPI.Core.Attributes;
using PluginAPI.Enums;
using PluginAPI.Events;
using RoundEvent.Event;
using RounEvent.Event;


namespace RoundEvent.Main
{
    internal class CodeLoad
    {
        public static CodeLoad Singleton { get; set; }

        [PluginConfig] public Config Config;



        [PluginEntryPoint("07 对局事件", "v1.0.0", "对局事件", "River")]
        [PluginPriority(LoadPriority.Medium)]
        public void Load()
        {
            if (!this.Config.IsEnabled) return;

            Singleton = this;

            Log.Info($"NWPluginAPI| 对局事件 | 加载");

            EventManager.RegisterEvents<BlackEvent>(Config.BlackEvent.IsEnabled);
            EventManager.RegisterEvents<GreenEvent>(Config.GreenEvent.IsEnabled);
            EventManager.RegisterEvents<BlueEvent>(Config.BlueEvent.IsEnabled);
            //EventManager.RegisterEvents<RedEvent>(Config.RedEvent.IsEnabled);
            EventManager.RegisterEvents<HappyEvent>(Config.GreenEvent.IsEnabled);
            EventManager.RegisterEvents<FogEvent>(Config.GreenEvent.IsEnabled);
        }

        [PluginUnload]
        public void UnLoad()
        {
            Singleton = null;
            EventManager.UnregisterEvents(Config.GreenEvent.IsEnabled);
        }
    }
}
